package com.simtop.car.utils;
import java.io.InputStreamReader;
import java.io.LineNumberReader;

public class PythonUtil {
    public static String getLine(String des){
        StringBuilder sb=new StringBuilder();
        //C:\manage\co-cosine.py
        //c:\\car\\co-cosine.py
        //F:\workspace\car
        String[] args = new String[] { "python", "c:\\car\\co-cosine.py", des };
        try{
            Process proc = Runtime.getRuntime().exec(args); //执行py文件
            InputStreamReader stdin = new InputStreamReader(proc.getInputStream(),"gbk");
            LineNumberReader input = new LineNumberReader(stdin);
            String line;
            while ((line = input.readLine()) != null) {
                sb.append(line);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return sb.toString();
    }
}
